The present invention generally relates to a memory controller for a flash memory, a flash memory system having the memory controller, and a method of controlling the flash memory.
In a memory system employing a flash memory, wear leveling is applied in order to even out the number of program-erase cycles (the number of times of execution of data erasing) among physical blocks in a flash memory, as shown in Reference 1 (JP-A-2007-133683).
There are substantially two wear leveling modes. One is called a dynamic wear leveling or a passive wear leveling, hereinafter referred as a “dynamic wear leveling”, and the other is called a static wear leveling or an active wear leveling, hereinafter referred as a “static wear leveling”. The dynamic wear leveling is to even out the number of program-erase cycles among physical blocks except static physical blocks. The static wear leveling is to even out the number of program-erase cycles among physical blocks including the static physical blocks. Each of the static physical blocks is a physical block storing static data, which are rarely updated or rewritten.
In the static wear leveling, static data stored in a static physical block are transferred to another physical block in order to store static data in a physical block of which the number of program-erase cycles is large. In the dynamic wear leveling, static data are not transferred unless it is necessary to rewrite them. Therefore, in a case where there are many static physical blocks (that is, where a ratio of static physical blocks to all physical blocks each storing data is high), it is preferable to apply the static wear leveling. And, in a case where there are few static physical blocks (that is, where a ratio of static physical blocks to all physical blocks each storing data is low), it is preferable to apply the dynamic wear leveling.